import csv
import numpy as np

math_scores = []
file_names = ["class1.csv","class2.csv","class3.csv"]
for file_name in file_names:
    with open(file_name,'r',encoding='utf-8') as file:
        reader = csv.reader(file)
        next(reader)
        for row in reader:
            math_scores.append(float(row[2]))
            math_scores_np = np.array(math_scores)
            mean_score = np.mean(math_scores_np)
            median_score = np.median(math_scores_np)
            score_count = {}
            for score in math_scores:
                score_count[score]=score_count.get(score,0) + 1
            mode_score = max(score_count,key=score_count.get)
            stp_score = np.std(math_scores_np)
            var_score = np.var(math_scores_np)
print(f"平均值: {mean_score}")
print(f"中位数:{median_score}")
print(f"众数: {mode_score}")
print(f"标准差: {stp_score}")
print(f"方差: {var_score}")